﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Components.Data
{
    public class Inventory
    {
        private Item[] pContent = new Item[73];
        private int[] pIndex = new int[73];

        public Item GetEquip(int parts)
        {
            if (parts < 0 || parts >= 31)
                return null;
            int index = pIndex[42 + parts];
            if (index < 0 || index >= 73)
                return null;
            return pContent[index];
        }

        public Item GetContent(int index)
        {
            if (index < 0 || index >= 73)
                return null;
            index = pIndex[index];
            if (index < 0 || index >= 42)
                return null;
            return pContent[pIndex[index]];
        }

        public void SetAt(int index, Item item)
        {
            if (index < 0 || index > 73)
                return;
            index = pIndex[index];
            if (index > 73 || index < 0)
                return;
            pContent[index] = item;
        }

        public void SetIndex(int index, int idx)
        {
            pIndex[index] = idx;
        }
    }
}
